<?php
/**
 * Created by PhpStorm.
 * User: serenehaly
 * Date: 2018/2/6
 * Time: 9:48
 */

namespace app\api\controller\v1;

use app\api\model\Category as CategoryModel;
use app\lib\exception\CategoryException;

class Category
{
    public function getAllCategories() {
        $category = CategoryModel::getAllCategory();
        if ($category->isEmpty()) {
            throw new CategoryException();
        } else {
            return $category;
        }
    }
}